package p046bf;

import com.google.gson.JsonParseException;
import okhttp3.Response;
import okhttp3.WebSocket;
import okhttp3.WebSocketListener;
import p114do.ByteString;
import p232id.ObservableCreate;
import p270jp.pxv.android.exception.RuntimeTypeNotRegisteredException;
import p270jp.pxv.android.model.pixiv_sketch.LiveWebSocketMessage;
import p350mp.Timber;
import p593wc.ObservableEmitter;

/* renamed from: bf.b */
/* loaded from: classes2.dex */
public class LiveWebSocketClient extends WebSocketListener {

    /* renamed from: a */
    public final /* synthetic */ ObservableEmitter f4978a;

    /* renamed from: b */
    public final /* synthetic */ C1122c f4979b;

    public LiveWebSocketClient(C1122c cVar, ObservableEmitter kVar) {
        this.f4979b = cVar;
        this.f4978a = kVar;
    }

    @Override // okhttp3.WebSocketListener
    public void onClosed(WebSocket webSocket, int i, String str) {
        ((ObservableCreate.C3769a) this.f4978a).m5172b();
    }

    @Override // okhttp3.WebSocketListener
    public void onClosing(WebSocket webSocket, int i, String str) {
    }

    @Override // okhttp3.WebSocketListener
    public void onFailure(WebSocket webSocket, Throwable th, Response response) {
        ((ObservableCreate.C3769a) this.f4978a).m5171c(th);
    }

    @Override // okhttp3.WebSocketListener
    public void onMessage(WebSocket webSocket, ByteString hVar) {
    }

    @Override // okhttp3.WebSocketListener
    public void onMessage(WebSocket webSocket, String str) {
        try {
            ((ObservableCreate.C3769a) this.f4978a).m5170d((LiveWebSocketMessage) this.f4979b.f4982c.m3440b(str, LiveWebSocketMessage.class));
        } catch (JsonParseException e) {
            Timber.f23100a.mo3514p(e);
        } catch (RuntimeTypeNotRegisteredException unused) {
        }
    }

    @Override // okhttp3.WebSocketListener
    public void onOpen(WebSocket webSocket, Response response) {
    }
}
